/* 
* @Author: fangshuqin
* @Date:   2018-05-04 11:28:55
* @Last Modified by:   ZHELIHAO\fangshuqin
* @Last Modified time: 2018-05-24 18:39:37
*/
{
    class Tips extends Laya.Dialog {
        constructor (msg) {
            super();

            this.group = "tips";
            this.CONFIG = {
                "closeByGroup" : true,
                "isModal" : false,
                "autoClose" : 2000
            };

            this.bg = null;
            this.text = null;
            
            this.init();
            this.update(msg);
        }

        init () {
            let bg = new Laya.Image("res/alert/public/bg_tips.png");
                bg.sizeGrid = "6,6,6,6";
                bg.left = -110;
                bg.right = -110;
                bg.top = -50;
                bg.bottom = -50;
            
            let text = new Laya.Label();
                text.fontSize = 24;
                text.color = "#ffffff";
                text.align = "center";
                text.leading = 6;
                text.centerX = 0;
                text.centerY = 0;

            this.bg = bg;
            this.text = text;

            this.addChildren(bg, text);
        }

        update (msg) {
            this.text.text = msg;
            if(this.text.width > 500){
                this.text.wordWrap = true;
                this.text.width = 500;
            }

            this.size(this.text.width, this.text.height);
        }
    }
    Sail.class(Tips, "Alert.Tips");
}